package com.zhengke.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhengke.common.dao.CommonDao;
import com.zhengke.common.object.Result;
import com.zhengke.pojo.Fwdxxtj;
@Service
public class FwdxxtjServiceImpl implements FwdxxtjService {
	/**
     * ssx
     * */
	@Autowired
	private CommonDao dao;
	
	/**
	 * ssx
	 * 服务点信息查询
	 * */
	@SuppressWarnings("unchecked")
	@Override
	public Result quaryAll(String startTime,String endTime,String quiz1,String quiz2,String quiz3,int pageNum,int size) throws Exception {
		
		Map<String,String> param = new HashMap<String,String>();
		param.put("startTime", startTime);
		param.put("endTime", endTime);
		param.put("quiz1", quiz1);
		param.put("quiz2", quiz2);
		param.put("quiz3", quiz3);
		
		PageHelper.startPage(pageNum, size, true);
		List<Fwdxxtj>list = (List<Fwdxxtj>) dao.findForList("FwdxxtjMapper.querys", param);
        PageInfo<Fwdxxtj> pageInfo = new PageInfo<Fwdxxtj>(list);
		Result rs = new Result();
		rs.setCode("0");
		rs.setCount(pageInfo.getTotal());
        rs.setData(list);		
		return rs;
	}
    
	
	/**
      * 查询父类
      * */
	@SuppressWarnings("unchecked")
	@Override
	public Result querys(int area_parent_id, Integer area_deep) throws Exception {
		Map<String,Object> param = new HashMap<String,Object>();
		Result rs = new Result();
		param.put("startTime", area_parent_id);
		param.put("endTime", area_deep);
		List<Fwdxxtj>list = (List<Fwdxxtj>) dao.findForList("FwdxxtjMapper.query", param);
		rs.setCode("0");
		rs.setData(list);
		return rs;
	}


	@Override
	public Result queryName(String area_name) throws Exception {
		Map<String,Object> param = new HashMap<String,Object>();
		Result rs = new Result();
		param.put("area_name", area_name);
		List<Fwdxxtj>list = (List<Fwdxxtj>) dao.findForList("FwdxxtjMapper.queryName", param);
		rs.setCode("0");
		rs.setData(list);
		return rs;
	}
	
	
	
	

}
